package com.ymatou.query.seller.trading.api.service;

import java.io.IOException;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;

import org.apache.http.client.ClientProtocolException;
import org.json.JSONArray;
import org.json.JSONException;

import com.ymatou.iapi.m.couponservice.parameter.CreateCouponBean;
import com.ymatou.iapi.m.couponservice.service.CreateCouponCall;
import com.ymatou.iapi.trading.operate.parameter.ActivityVo;
import com.ymatou.iapi.trading.operate.parameter.OrderGroupVo;
import com.ymatou.iapi.trading.operate.parameter.OrderItemVo;
import com.ymatou.iapi.trading.operate.parameter.OrderVo;
import com.ymatou.iapi.trading.operate.parameter.PlaceOrderService;
import com.ymatou.iapi.trading.operate.parameter.SellerCouponVo;
import com.ymatou.iapi.trading.operate.parameter.SellerPromotionVo;
import com.ymatou.iapi.trading.operate.parameter.YmatouCouponVo;
import com.ymatou.iapi.trading.operate.parameter.enums.ActivityPromotionTypeEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.AppTerminalSourceEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.LogisticsTypeEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.OrderSourceEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.OrderTypeEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.PriceTypeEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.ProductRefundChannelEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.PromotionTypeEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.SalesTypeEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.SellerCouponApplianceTypeEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.TerminalSourceEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.YmatouCouponApplianceTypeEnum;
import com.ymatou.iapi.trading.operate.parameter.req.ApplySalesRefundRequestBean;
import com.ymatou.iapi.trading.operate.parameter.req.PlaceOrderReq;
import com.ymatou.iapi.trading.operate.service.PlaceOrderCall;
import com.ymatou.operate.trading.api.parameter.CancelOrderBean;
import com.ymatou.operate.trading.api.parameter.OrderPostPayRequestBean;
import com.ymatou.operate.trading.api.service.CancelOrderCall;
import com.ymatou.operate.trading.api.service.OrderPostPayRequestCall;
import com.ymt.core.tool.Logger;
import com.ymttest.business.service.CouponCallService;
import com.ymttest.business.service.CouponServiceMCallService;
import com.ymttest.business.service.OrderCallService;
import com.ymttest.common.entitie.C2COrderInfo;
import com.ymttest.common.entitie.C2COrderInfo.C2COrderInfoExt;
import com.ymttest.common.enums.CancelOrderTypeEnum;
import com.ymttest.common.enums.PlatformEnum;
import com.ymttest.utils.DataUtil;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;

/**
 * @see com.ymttest.business.service.OrderCallService
 * @author songyefeng
 *
 */
public class OrderCreate {
	public static class ProductInfo {
		private String catalogId = TestDataManager.getRandomUUID().toString();
		private String productId = TestDataManager.getRandomUUID().toString();
		private String name;
		private String pic = "http://p243.img.ymatou.com:10243/upload/productdes/"
				+ productId + ".jpg";
		private BigDecimal price = new BigDecimal(
				DataUtil.Random.getRandomIntFromRange(100, 1000));
		private BigDecimal weight = new BigDecimal(
				DataUtil.Random.getRandomIntFromRange(9, 999));

		public String getCatalogId() {
			return catalogId;
		}

		public void setCatalogId(String catalogId) {
			this.catalogId = catalogId;
		}

		public String getProductId() {
			return productId;
		}

		public void setProductId(String productId) {
			this.productId = productId;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public String getPic() {
			return pic;
		}

		public void setPic(String pic) {
			this.pic = pic;
		}

		public BigDecimal getPrice() {
			return price;
		}

		public void setPrice(BigDecimal price) {
			this.price = price;
		}

		public BigDecimal getWeight() {
			return weight;
		}

		public void setWeight(BigDecimal weight) {
			this.weight = weight;
		}

	}

	public static final String[] PRODUCT_NAME = {"美国进口车厘子", "智力车厘子", "nick运动鞋",
			"nike跑鞋", "adidas运动鞋", "童装"};

	public static ProductInfo getRandomProduct() {
		int size = PRODUCT_NAME.length;
		ProductInfo[] productInfos = new ProductInfo[size];
		for (int i = 0; i < size; i++) {
			ProductInfo productInfo = new ProductInfo();
			productInfo.setName(PRODUCT_NAME[i] + "-"
					+ YMTDateUtil.getBeforeOrNextDay(0, YMTDateUtil.YMD));
			productInfos[i] = productInfo;
		}
		int index = DataUtil.Random.getRandomIntFromRange(0, size - 1);
		return productInfos[index];
	}

	public static class UserInfo {
		private String name;
		private String phone;
		private String address;
		private String postcode;
		private String telephone;
		private String leaveword;

		public String getAddress() {
			return address;
		}

		public void setAddress(String address) {
			this.address = address;
		}

		public String getPostcode() {
			return postcode;
		}

		public void setPostcode(String postcode) {
			this.postcode = postcode;
		}

		public String getTelephone() {
			return telephone;
		}

		public void setTelephone(String telephone) {
			this.telephone = telephone;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public String getPhone() {
			return phone;
		}

		public void setPhone(String phone) {
			this.phone = phone;
		}

		public String getLeaveword() {
			return leaveword;
		}

		public void setLeaveword(String leaveword) {
			this.leaveword = leaveword;
		}

	}

	public static final String[] NAMES = {"张三", "李四", "王五"};
	public static final String[] MOBILES = {"13123456789", "13223456789",
			"13323456789"};
	public static final String[] ADDRESS = {"上海市静安区灵石路123号", "上海市虹口区西宝兴路123号",
			"浙江省杭州市西湖区雷峰塔路66号"};
	public static final String[] POSTCODE = {"200011", "200092", "100011"};
	public static final String[] TELEPHONE = {"021-65217894", "021-61317894",
			"0571-22357541"};
	public static final String[] LEAVEWORD = {"请尽快发货", "选择黄色那款", "收到留言请回复"};

	public static UserInfo getRandomUser() {
		int size = NAMES.length;
		UserInfo[] users = new UserInfo[size];
		for (int i = 0; i < size; i++) {
			UserInfo userInfo = new UserInfo();
			userInfo.setName(NAMES[i]);
			userInfo.setPhone(MOBILES[i]);
			userInfo.setAddress(ADDRESS[i]);
			userInfo.setPostcode(POSTCODE[i]);
			userInfo.setTelephone(TELEPHONE[i]);
			userInfo.setLeaveword(LEAVEWORD[i]);
			users[i] = userInfo;
		}
		int index = DataUtil.Random.getRandomIntFromRange(0, size - 1);

		return users[index];
	}

	public String createCouponBatchCode() throws Exception {

		CouponServiceMCallService couponServiceMCallService = new CouponServiceMCallService();

		CreateCouponBean createCouponBean = couponServiceMCallService
				.setDefaultPlatformCreateCouponBeanForRecieve();
		CreateCouponCall createCouponCall = couponServiceMCallService
				.createPlatformCoupon(createCouponBean);

		return createCouponCall.getBatchCode();
	}

	public C2COrderInfoExt createOrderWithSellerCoupon(int userId, int sellerId) {
		OrderCallService orderCallService = new OrderCallService();
		Map map = placeOrder(userId, sellerId);
		JSONArray orderIds = (JSONArray) map.get("orderIds");
		int tradingId = (Integer) map.get("tradingId");
		int orderId = 0;
		try {
			orderId = orderIds.getInt(0);
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		// 付款金额
		DecimalFormat df = new DecimalFormat("0.00");// 保留两位小数
		BigDecimal amount = orderCallService.getNeedPrePayAmountOfCash(orderId);
		// 付款
		orderCallService.orderPayRequest(userId, amount, tradingId);
		C2COrderInfoExt order = new C2COrderInfoExt();
		order.setiOrderId(orderId);
		order.setiTradingId(tradingId);
		return order;
	}

	private Map placeOrder(int userId, int sellerId) {
		Map map = new HashMap();
		try {
			PlaceOrderReq placeorderBean = new PlaceOrderReq();
			PlaceOrderCall placeorderCall = new PlaceOrderCall();
			ProductInfo product = getRandomProduct();
			// 创建产品
			Logger.comment("前置数据准备");
			Logger.comment("前置数据准备结束");
			YmatouCouponVo ymtCoupon = new YmatouCouponVo();
			// 平台优惠券
			BigDecimal couponValue = new BigDecimal(13);
			String couponCode = new OrderCallService().receivePlatformCoupon(
					userId, couponValue);
			ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
			ymtCoupon.setCouponCode(couponCode);
			ymtCoupon.setCouponValue(couponValue);
			placeorderBean.setAppId("AutoTest");
			placeorderBean.setYmatouCoupon(ymtCoupon);
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			placeorderBean.setSourceIp("127.0.0.1");
			placeorderBean.setAppId("ios");
			placeorderBean.setDeviceId("7777777777888888888888999");
			OrderGroupVo groupVo1 = new OrderGroupVo();
			placeorderBean.setOrderSource(OrderSourceEnum.PC);
			// 商家优惠券
			BigDecimal sellerCouponValue = new BigDecimal(15);
			String sellerCouponCode = new CouponCallService()
					.receiveCouponInfo(sellerId, userId, couponValue);
			SellerCouponVo sellerCoupon = new SellerCouponVo();
			sellerCoupon.setApplianceType(SellerCouponApplianceTypeEnum.ALL);
			sellerCoupon.setCouponCode(sellerCouponCode);
			sellerCoupon.setCouponValue(sellerCouponValue);
			groupVo1.setSellerCoupon(sellerCoupon);
			groupVo1.setSellerId(sellerId);
			List<OrderVo> orders = new ArrayList<OrderVo>();
			OrderVo ordervo1 = new OrderVo();
			ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo1.setOrderType(OrderTypeEnum.Spot);
			ordervo1.setPaidFull(true);
			ordervo1.setAddress("上海市闸北区灵石路636号");
			ordervo1.setLeaveWord("ymt autotest");
			ordervo1.setPhone("13100000001");
			ordervo1.setPostCode("200001");
			ordervo1.setTelephone("021-51002100");
			ordervo1.setReceiveName("李四");
			List<OrderItemVo> items = new ArrayList<OrderItemVo>();
			OrderItemVo orderitem = new OrderItemVo();
			orderitem.setCatalogId(TestDataManager.getRandomUUID().toString());
			orderitem.setProductNum(3);
			SellerPromotionVo sellerPromotionVo = new SellerPromotionVo();
			sellerPromotionVo.setAmountCondition(new BigDecimal(1));
			sellerPromotionVo.setId(1231231231);
			sellerPromotionVo.setName("aaaaa");
			Set<String> productIds = new HashSet<String>();
			productIds.add(product.getProductId());
			sellerPromotionVo.setProductIds(productIds);
			sellerPromotionVo.setPromotionValue(new BigDecimal(1));
			sellerPromotionVo.setReducedAmount(new BigDecimal(1));
			sellerPromotionVo.setType(PromotionTypeEnum.ReduceIfAmountEnough);
			orderitem.setSellerPromotion(sellerPromotionVo);
			orderitem.setProductName(product.getName());
			orderitem.setPriceType(PriceTypeEnum.VipPrice);
			orderitem.setProductId(product.getProductId());
			orderitem.setEarnestPrice(product.getPrice());
			orderitem.setProductPrice(product.getPrice());
			orderitem.setOriginalPrice(product.getPrice());
			orderitem.setSalesType(SalesTypeEnum.AlreadyInStock);
			orderitem.setLogisticsType(LogisticsTypeEnum.SailProtect);
			orderitem
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem.setBrandId(5);
			orderitem.setPackageNo("11111111");
			orderitem.setFirstCategoryId(111111111);
			orderitem.setSecondCategoryId(22222222);
			orderitem.setThirdCategoryId(3333333);
			orderitem
					.setProductDetailInfo("e5a1eccf-6a14-458f-b907-35dc9a3d2713#适用人群:b13e9eb1-98d6-4d39-8c35-225758e443d3#男");
			orderitem.setProductRecordNo("1234567");
			orderitem
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem
					.setProperty("06f25e0c-e431-44ae-8a07-4d0bc824e3bd#尺寸:951a814e-2ded-4241-b9a0-91b2cd9a44fd#6,d2f663ea-3214-4344-abce-a8eaffcc43ce#颜色:f3ed3ad7-a084-450b-b698-256542963306#红色");
			ActivityVo activity = new ActivityVo();
			activity.setActivityId(46870);
			activity.setActivityBeginDate(YMTDateUtil.getBeforeOrNextDay(-10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityEndDate(YMTDateUtil.getBeforeOrNextDay(10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityTemplateId(12345678);
			activity.setCommissionRate(new BigDecimal(1.1));
			activity.setCost(true);
			activity.setFeeFree(false);
			activity.setPremium(new BigDecimal(1.5));
			activity.setPromotionPrice(new BigDecimal(15));
			activity.setPromotionType(ActivityPromotionTypeEnum.DiscountRate);
			activity.setUseCoupon(true);
			orderitem.setActivity(activity);
			ordervo1.setOrderItems(items);
			ordervo1.setFreight(new BigDecimal("21"));
			items.add(orderitem);
			ordervo1.setOrderItems(items);
			ordervo1.setFreight(new BigDecimal("21"));
			orders.add(ordervo1);
			groupVo1.setOrders(orders);
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();
			SellerPromotionVo sp11 = new SellerPromotionVo();
			sp11.setAmountCondition(BigDecimal.TEN);
			sp11.setId(11);
			sp11.setName("test");
			sp11.setProductIds(productIds);
			sp11.setPromotionValue(BigDecimal.ONE);
			sp11.setReducedAmount(BigDecimal.ONE);
			sp11.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotionList.add(sp11);

			groupVo1.setSellerPromotions(sellerPromotionList);
			placeorderBean.setOrderGroups(Arrays.asList(groupVo1));
			placeorderCall.setData(false, placeorderBean);
			placeorderCall.callService();
			JSONArray orderIds = placeorderCall.getOrderIds();
			int tradingId = placeorderCall.getTradingId();
			map.put("orderIds", orderIds);
			map.put("tradingId", tradingId);
		} catch (Exception e) {
			Logger.fail(e);
		}
		return map;
	}

	/**
	 * 订单商品数量
	 */
	private int productCount = 1;

	public int getProductCount() {
		return productCount;
	}

	public void setProductCount(int count) {
		this.productCount = count;
	}

	/**
	 * 
	 * 获取java 下单PlaceOrder 接口默认的请求bean
	 * 
	 * 新java 下单，不区分 M,C 商品，是否需要补款看isPaidFull(
	 *
	 */
	public PlaceOrderReq getDefaultPlaceOrderBean(int userId, int sellerId) {

		ProductInfo[] products = new ProductInfo[getProductCount()];
		for (int i = 0; i < products.length; i++) {
			products[i] = getRandomProduct();
		}
		UserInfo user = getRandomUser();
		PlaceOrderReq placeorderBean = new PlaceOrderReq();
		// 创建产品
		placeorderBean.setAppId("AutoTest");
		// placeorderBean.setYmatouCoupon(ymtCoupon);
		placeorderBean.setUserId(userId);
		placeorderBean.setRequestId(TestDataManager.getRandomUUID().toString());
		placeorderBean.setEquipmentId("111111111");
		placeorderBean
				.setTerminalSource(com.ymatou.iapi.trading.operate.parameter.enums.TerminalSourceEnum.IOS);
		placeorderBean
				.setAppTerminalSource(com.ymatou.iapi.trading.operate.parameter.enums.AppTerminalSourceEnum.Phone);
		OrderGroupVo groupVo1 = new OrderGroupVo();
		// 定义买手下的优惠商品信息list
		List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();
		SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();
		sellerPromotion1.setAmountCondition(new BigDecimal(100));
		sellerPromotion1.setId(123456789);
		sellerPromotion1.setName("自动化商家优惠活动");
		Set<String> productList = new HashSet<String>();
		productList.add("aaaa");
		productList.add("bbbb");
		sellerPromotion1.setProductIds(productList);
		sellerPromotion1.setPromotionValue(new BigDecimal(12));
		sellerPromotion1.setQtyCondition(4);
		sellerPromotion1.setReducedAmount(new BigDecimal(1));
		sellerPromotion1.setType(PromotionTypeEnum.DiscountIfCountEnough);
		SellerPromotionVo sellerPromotion2 = new SellerPromotionVo();
		sellerPromotion2.setAmountCondition(new BigDecimal(100));
		sellerPromotion2.setId(123456789);
		sellerPromotion2.setName("自动化商家优惠活动");
		Set<String> productList2 = new HashSet<String>();
		productList2.add("cccc");
		sellerPromotion2.setProductIds(productList2);
		sellerPromotion2.setPromotionValue(new BigDecimal(12));
		sellerPromotion2.setQtyCondition(4);
		sellerPromotion2.setReducedAmount(new BigDecimal(2));
		sellerPromotion2.setType(PromotionTypeEnum.ReduceIfAmountEnough);

		sellerPromotionList.add(sellerPromotion1);
		groupVo1.setSellerPromotions(sellerPromotionList);
		placeorderBean
				.setOrderSource(com.ymatou.iapi.trading.operate.parameter.enums.OrderSourceEnum.APP);
		groupVo1.setSellerId(sellerId);
		List<OrderVo> orders = new ArrayList<OrderVo>();
		OrderVo ordervo1 = new OrderVo();
		ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
		ordervo1.setOrderType(com.ymatou.iapi.trading.operate.parameter.enums.OrderTypeEnum.Shangou);
		// 无需补款
		ordervo1.setPaidFull(true);
		ordervo1.setAddress(user.getAddress());
		ordervo1.setLeaveWord(user.getLeaveword());
		ordervo1.setPhone(user.getPhone());
		ordervo1.setPostCode(user.getPostcode());
		ordervo1.setTelephone(user.getTelephone());
		ordervo1.setReceiveName(user.getName());

		List<OrderItemVo> items = new ArrayList<OrderItemVo>();

		// 添加商品
		for (int i = 0; i < products.length; i++) {
			OrderItemVo orderitem = new OrderItemVo();
			orderitem.setProductNum(1);
			orderitem.setProductName(products[i].getName());
			orderitem
					.setPriceType(com.ymatou.iapi.trading.operate.parameter.enums.PriceTypeEnum.VipPrice);
			orderitem.setCatalogId(products[i].getCatalogId().toString());
			orderitem.setProductId(products[i].getProductId().toString());
			orderitem.setEarnestPrice(products[i].getPrice());
			orderitem.setProductPrice(products[i].getPrice());
			orderitem.setOriginalPrice(products[i].getPrice());
			orderitem
					.setStockStatus(com.ymatou.iapi.trading.operate.parameter.enums.StockStatusEnum.Spot);
			orderitem.setSalesType(SalesTypeEnum.AlreadyInStock);
			orderitem.setFreightFree(true);
			orderitem
					.setLogisticsType(com.ymatou.iapi.trading.operate.parameter.enums.LogisticsTypeEnum.SailProtect);
			orderitem
					.setProductRefundChannel(com.ymatou.iapi.trading.operate.parameter.enums.ProductRefundChannelEnum.Official);
			orderitem.setBrandId(5);
			orderitem.setPackageNo("11111111");
			orderitem.setFirstCategoryId(111111111);
			orderitem.setSecondCategoryId(22222222);
			orderitem.setThirdCategoryId(3333333);
			orderitem
					.setProductDetailInfo("e5a1eccf-6a14-458f-b907-35dc9a3d2713#适用人群:b13e9eb1-98d6-4d39-8c35-225758e443d3#男");
			orderitem.setProductRecordNo("1234567");
			orderitem
					.setProductRefundChannel(com.ymatou.iapi.trading.operate.parameter.enums.ProductRefundChannelEnum.Official);
			orderitem
					.setProperty("06f25e0c-e431-44ae-8a07-4d0bc824e3bd#尺寸:951a814e-2ded-4241-b9a0-91b2cd9a44fd#6,d2f663ea-3214-4344-abce-a8eaffcc43ce#颜色:f3ed3ad7-a084-450b-b698-256542963306#红色");
			ActivityVo activity = new ActivityVo();
			activity.setActivityId(46870);
			activity.setActivityBeginDate(YMTDateUtil.getBeforeOrNextDay(-10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityEndDate(YMTDateUtil.getBeforeOrNextDay(10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityTemplateId(12345678);
			activity.setCommissionRate(new BigDecimal(1.1));
			activity.setCost(true);
			activity.setFeeFree(false);
			activity.setPremium(new BigDecimal(1.5));
			activity.setPromotionPrice(new BigDecimal(15));
			activity.setPromotionType(ActivityPromotionTypeEnum.DiscountRate);
			activity.setUseCoupon(true);
			orderitem.setActivity(activity);
			items.add(orderitem);
		}
		ordervo1.setOrderItems(items);
		ordervo1.setFreight(new BigDecimal("21"));
		orders.add(ordervo1);
		groupVo1.setOrders(orders);
		placeorderBean.setOrderGroups(Arrays.asList(groupVo1));
		return placeorderBean;
	}

	/**
	 * 批量创建C2C订单,iTradingStatus=1
	 * 
	 * @param userId
	 * @param sellerId
	 * @param orderNum
	 *            订单数
	 * @return
	 */
	public List<C2COrderInfo> create1_BatchC2COrder(int userId, int sellerId,
			int orderNum) {
		List<C2COrderInfo> orderInfos = new ArrayList<C2COrderInfo>();
		try {
			PlaceOrderReq placeorderBean = getDefaultPlaceOrderBean(userId,
					sellerId);
			com.ymatou.iapi.trading.operate.service.PlaceOrderCall placeorderCall = new com.ymatou.iapi.trading.operate.service.PlaceOrderCall();
			// 商品预付定金价
			BigDecimal earnestPrice = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0)
					.getEarnestPrice();
			BigDecimal originalPrice = earnestPrice.add(new BigDecimal(50));

			String productId = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0).getProductId();
			String catalogId = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0).getCatalogId();

			// 买家用户id
			placeorderBean.setUserId(userId);
			// 商家用id
			placeorderBean.getOrderGroups().get(0).setSellerId(sellerId);
			// 全款
			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.setPaidFull(true);
			// 原价
			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setOriginalPrice(originalPrice);
			// 设置sellerid
			placeorderBean.getOrderGroups().get(0).setSellerId(sellerId);
			// 成交价
			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setProductPrice(originalPrice);
			// 运费
			BigDecimal freight = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getFreight();
			// 设置为不是活动商品
			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setActivity(null);
			// 商品数量
			int productNum = placeorderBean.getOrderGroups().get(0).getOrders()
					.get(0).getOrderItems().get(0).getProductNum();
			// 复制商品订单信息，创建多个 order
			for (int i = 0; i < orderNum - 1; i++) {
				placeorderBean
						.getOrderGroups()
						.get(0)
						.getOrders()
						.add(placeorderBean.getOrderGroups().get(0).getOrders()
								.get(0));
			}
			// 计算支付总价 =(商品价格X数量+运费)X订单数量
			BigDecimal totalPrice = (earnestPrice.multiply(new BigDecimal(
					productNum)).add(freight))
					.multiply(new BigDecimal(orderNum));
			// 发送数据
			placeorderCall.setData(false, placeorderBean);
			Logger.comment("创建" + orderNum + "个M端订单");
			placeorderCall.callService();
			Logger.debug("createordercall send:"
					+ placeorderCall.getEntityString());
			Logger.debug("createordercall response:"
					+ placeorderCall.getReturnData());
			if (!(placeorderCall.getString("code").equals("200"))) {
				Logger.comment("保存批量M全款订单失败:" + placeorderCall.getReturnData());
			}
			// 交易号
			int tradingId = placeorderCall.getTradingId();
			// 订单号
			JSONArray orderIds = placeorderCall.getOrderIds();
			for (int i = 0; i < orderIds.length(); i++) {
				C2COrderInfo orderInfo = new C2COrderInfo();
				orderInfo.setiTradingId(tradingId);
				orderInfo.setiOrderId(orderIds.getInt(i));
				orderInfo.setiUserId(userId);
				orderInfo.setiBuyerId(sellerId);
				orderInfo.setfTotalPrice(totalPrice);
				orderInfo.setsProductId(productId);
				orderInfo.setsCatalogId(catalogId);
				orderInfos.add(orderInfo);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return orderInfos;
	}

	/**
	 * 新的创建c2c订单方法 调用ProductCallService.createC2CProduct 创建直播商品
	 * 
	 * @return orderMap
	 */
	@Deprecated
	public C2COrderInfoExt appSaveOrder(int userId, int sellerId) {
		C2COrderInfoExt orderInfo = new C2COrderInfoExt();
		PlaceOrderReq placeorderBean = getDefaultPlaceOrderBean(userId,
				sellerId);
		com.ymatou.iapi.trading.operate.service.PlaceOrderCall placeorderCall = new com.ymatou.iapi.trading.operate.service.PlaceOrderCall();
		try {
			placeorderBean.setUserId(userId);
			// 商品预付定金价
			BigDecimal earnestPrice = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0)
					.getEarnestPrice();
			String productId = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0).getProductId();
			String catalogId = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0).getCatalogId();
			int activityId = placeorderBean.getOrderGroups().get(0).getOrders()
					.get(0).getOrderItems().get(0).getActivity()
					.getActivityId();
			// 设置买手
			placeorderBean.getOrderGroups().get(0).setSellerId(sellerId);
			// 运费
			BigDecimal freight = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getFreight();
			// 商品数量
			int productNum = placeorderBean.getOrderGroups().get(0).getOrders()
					.get(0).getOrderItems().get(0).getProductNum();
			// 计算支付总价 =商品价格X数量+运费
			BigDecimal totalPrice = earnestPrice.multiply(
					new BigDecimal(productNum)).add(freight);
			// 发送数据
			placeorderCall.setData(false, placeorderBean);
			Logger.comment("创建一个C端直播商品订单");
			placeorderCall.callService();
			Logger.debug("createordercall send:"
					+ placeorderCall.getEntityString());
			Logger.debug("createordercall response:"
					+ placeorderCall.getReturnData());
			if (!(placeorderCall.getString("code").equals("200"))) {
				Logger.debug("保存闪购订单失败:" + placeorderCall.getReturnData());
			}
			// 交易号
			int tradingId = placeorderCall.getTradingId();
			// 订单号 这里只创建了一个订单
			int orderId = placeorderCall.getOrderIds().getInt(0);
			orderInfo.setiTradingId(tradingId);
			orderInfo.setiOrderId(orderId);
			orderInfo.setiUserId(userId);
			orderInfo.setiBuyerId(sellerId);
			orderInfo.setfTotalPrice(totalPrice);
			orderInfo.setsProductId(productId);
			orderInfo.setfFreight(freight);
			orderInfo.setsCatalogId(catalogId);
			orderInfo.setiActivityId(activityId);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return orderInfo;
	}

	/**
	 * 新的创建订单方法 调用ProductCallService.createProduct 创建商品, iTradingStatus=1
	 * 
	 * @return map
	 */
	public C2COrderInfoExt create1_M2cOrder(int userId, int sellerId) {
		C2COrderInfoExt orderInfo = new C2COrderInfoExt();
		try {

			PlaceOrderReq placeorderBean = getDefaultPlaceOrderBean(userId,
					sellerId);

			com.ymatou.iapi.trading.operate.service.PlaceOrderCall placeorderCall = new com.ymatou.iapi.trading.operate.service.PlaceOrderCall();
			// 商品预付定金价
			BigDecimal earnestPrice = BigDecimal.TEN;
			String productId = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0).getProductId();
			String productName = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0).getProductName();
			String receivePerson = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getReceiveName();
			String receiverPhone = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getPhone();
			String catalogId = placeorderBean.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0).getCatalogId();
			int activityId = placeorderBean.getOrderGroups().get(0).getOrders()
					.get(0).getOrderItems().get(0).getActivity()
					.getActivityId();

			if (PlaceOrderService.isUserCoupon) {

				YmatouCouponVo ymtCoupon = new YmatouCouponVo();
				// 平台优惠券
				ymtCoupon.setApplianceType(YmatouCouponApplianceTypeEnum.ALL);
				String batchCode = createCouponBatchCode();
				ymtCoupon.setCouponCode(new CouponServiceMCallService()

				.receiveCouponInfo(batchCode, userId).getUserReceiveResult()
						.getCouponCode());
				ymtCoupon.setCouponValue(new BigDecimal(1.00));

				placeorderBean.setYmatouCoupon(ymtCoupon);
			}
			// 买家用户id
			placeorderBean.setUserId(userId);
			// 商家用id
			placeorderBean.getOrderGroups().get(0).setSellerId(sellerId);
			// 订单付全款
			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.setPaidFull(true);
			// 成交价
			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setEarnestPrice(earnestPrice);
			// 原价
			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setOriginalPrice(earnestPrice);
			// 设置sellerid
			placeorderBean.getOrderGroups().get(0).setSellerId(sellerId);
			// 成交价
			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setProductPrice(earnestPrice);

			// 设置为不是活动商品
			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setActivity(null);
			// 商品数量
			placeorderBean.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0)
					.setProductNum(1 + new Random().nextInt(5));

			placeorderCall.setData(false, placeorderBean);
			Logger.comment("创建一个M端订单");
			placeorderCall.callService();
			Logger.debug("createordercall send:"
					+ placeorderCall.getEntityString());
			Logger.debug("createordercall response:"
					+ placeorderCall.getReturnData());
			if (!(placeorderCall.getString("code").equals("200"))) {
				Logger.comment("保存M订单失败:" + placeorderCall.getReturnData());
			}
			// 交易号
			int tradingId = placeorderCall.getTradingId();
			// 订单号 这里只创建了一个订单
			int orderId = placeorderCall.getOrderIds().getInt(0);
			int mainOrderId = placeorderCall.getMainOrderId();
			BigDecimal totalPrice = new OrderCallService()
					.getNeedPrePayAmountOfCashBymainOrderId(mainOrderId);
			orderInfo.setiTradingId(tradingId);
			orderInfo.setiOrderId(orderId);
			orderInfo.setiUserId(userId);
			orderInfo.setiBuyerId(sellerId);
			orderInfo.setfTotalPrice(totalPrice);
			orderInfo.setsProductId(productId);
			orderInfo.setsCatalogId(catalogId);
			orderInfo.setiActivityId(activityId);
			orderInfo.setiMainOrderId(mainOrderId);
			orderInfo.setsReceivePerson(receivePerson);
			orderInfo.setsPhone(receiverPhone);
			orderInfo.setsTitle(productName);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return orderInfo;
	}

	/**
	 * 创建支付的订单, iTradingStatus=2
	 * 
	 * @param userId
	 * @param sellerId
	 * @return
	 */
	public C2COrderInfoExt create2_PayOrder(int userId, int sellerId) {
		C2COrderInfoExt orderInfo = create1_M2cOrder(userId, sellerId);
		int tradingId = orderInfo.getiTradingId();
		BigDecimal totalPrice = orderInfo.getfTotalPrice();
		// 支付订单
		new OrderCallService().orderPayRequest(userId, totalPrice, tradingId);
		return orderInfo;
	}

	/**
	 * 创建接单成功的订单, iTradingStatus=17
	 * 
	 * @param userId
	 * @param sellerId
	 */
	public C2COrderInfoExt create17_AcceptOrder(int userId, int sellerId) {
		C2COrderInfoExt orderInfo = create2_PayOrder(userId, sellerId);
		int orderId = orderInfo.getiOrderId();
		// 接单
		new OrderCallService().acceptOrder(orderId, sellerId);
		// 发货
		// new OrderCallService().dispatched(orderId, sellerId);
		return orderInfo;
	}

	/**
	 * 接单后, 创建申请退款的订单, iTradingStatus=17, iSalesRefundStatus=1
	 * 
	 * @param userId
	 * @param sellerId
	 * @throws Exception
	 */
	public C2COrderInfoExt create17_ApplyRefundOrder(int userId, int sellerId) {
		C2COrderInfoExt orderInfo = create17_AcceptOrder(userId, sellerId);
		int orderId = orderInfo.getiOrderId();
		// 申请退款
		ApplySalesRefundRequestBean applysalesrefundrequestBean = new OrderCallService()
				.applySalesRefundRequestInJavaBean(orderId);
		applysalesrefundrequestBean.setOrderId(orderId);
		new OrderCallService()
				.applySalesRefundRequestCall(applysalesrefundrequestBean);

		return orderInfo;
	}

	/**
	 * 创建退款失败的订单, iTradingStatus=17, iSalesRefundStatus=-10
	 * 
	 * @param userId
	 * @param sellerId
	 * @throws Exception
	 */
	public C2COrderInfoExt create17_RefundFailedOrder(int userId, int sellerId) {
		C2COrderInfoExt orderInfo = create17_AcceptOrder(userId, sellerId);
		int orderId = orderInfo.getiOrderId();
		new OrderCallService().salesrefundfailRequestAllProducts(orderId);
		return orderInfo;
	}

	/**
	 * 接单后, 创建退款成功的订单, iTradingStatus=12, iSalesRefundStatus=10
	 * 
	 * @param userId
	 * @param sellerId
	 * @throws Exception
	 */
	public C2COrderInfoExt create17_RefundOrder(int userId, int sellerId) {
		C2COrderInfoExt orderInfo = create17_AcceptOrder(userId, sellerId);
		int orderId = orderInfo.getiOrderId();
		new OrderCallService().salesRefundSuccessRequestAllProducts(orderId);
		return orderInfo;
	}

	/**
	 * 接单后, 创建部分退款成功的订单, iTradingStatus=12, iSalesRefundStatus=10
	 * 
	 * @param userId
	 * @param sellerId
	 * @throws Exception
	 */
	public C2COrderInfoExt create17_RefundPartOrder(int userId, int sellerId) {
		C2COrderInfoExt orderInfo = create17_AcceptOrder(userId, sellerId);
		int orderId = orderInfo.getiOrderId();

		ApplySalesRefundRequestBean applySalesRefundRequestBean = new OrderCallService()
				.applySalesRefundRequestInJavaBean(orderId);

		applySalesRefundRequestBean.getSalesRefundInfoList().get(0)
				.setRefundAmount(new BigDecimal(9));

		applySalesRefundRequestBean.getSalesRefundInfoList().get(0)
				.setRefundProductNum(1);

		new OrderCallService()
				.applySalesRefundRequestCall(applySalesRefundRequestBean);

		new OrderCallService()
				.salesrefundsuccessrequest(applySalesRefundRequestBean);

		return orderInfo;
	}
	/**
	 * 创建(卖家)申请补款的订单, iTradingStatus=16
	 * 
	 * @param userId
	 * @param sellerId
	 */
	@Deprecated
	public C2COrderInfoExt create16_ApplyForPostPayOrder(int userId,
			int sellerId) {
		C2COrderInfoExt orderInfo = appSaveOrder(userId, sellerId);
		int orderId = orderInfo.getiOrderId();
		int tradingId = orderInfo.getiTradingId();
		DecimalFormat df = new DecimalFormat("0.00");// 保留两位小数
		BigDecimal totalPrice = orderInfo.getfTotalPrice();// 支付金额
		// 支付前账户金额
		new OrderCallService().orderPayRequest(userId, totalPrice, tradingId);
		// 接单
		new OrderCallService().acceptOrder(orderId, sellerId);
		// 卖家发起补款
		int price = 1 + new Random().nextInt(50);
		BigDecimal payAmount = new BigDecimal(df.format(price));
		orderInfo.setPostpayAmount(payAmount);
		new OrderCallService().applyForPostPay(orderId, sellerId, payAmount);
		return orderInfo;
	}

	/**
	 * 创建补款支付订单, iTradingStatus=1
	 * 
	 * @param userId
	 * @param sellerId
	 */
	public C2COrderInfoExt create17_PostPayOrder(int userId, int sellerId) {
		OrderPostPayRequestBean orderpostpayrequestbean = new OrderPostPayRequestBean();
		OrderPostPayRequestCall orderpostpayrequestcall = new OrderPostPayRequestCall();
		C2COrderInfoExt orderInfo = create16_ApplyForPostPayOrder(userId,
				sellerId);
		int orderId = orderInfo.getiOrderId();
		BigDecimal payAmount = orderInfo.getPostpayAmount();
		// 参数
		orderpostpayrequestbean.setUserId(userId);
		orderpostpayrequestbean.setOrderId(orderId);
		orderpostpayrequestbean.setTradingPwd("abc123");
		BigDecimal GiftAmount = new BigDecimal(0);
		orderpostpayrequestbean.setUseGiftAmount(GiftAmount);
		orderpostpayrequestbean.setBankId("");
		orderpostpayrequestbean.setUserIp("127.0.0.1");
		orderpostpayrequestbean.setMemo("备注");
		orderpostpayrequestbean.setUseAccountAmount(payAmount);
		orderpostpayrequestbean.setCallBackUrl("http://www.baidu.com");
		orderpostpayrequestbean.setUsePlatform(PlatformEnum.Shangou_APP);
		orderpostpayrequestbean.setParamExt("");
		orderpostpayrequestbean.setPayType("10");
		// 发送请求
		orderpostpayrequestcall.setData(orderpostpayrequestbean);
		Logger.comment("前置数据准备结束");
		try {
			orderpostpayrequestcall.callService();
		} catch (ClientProtocolException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return orderInfo;
	}

	/**
	 * 创建发货的订单, iTradingStatus=3
	 * 
	 * @param userId
	 * @param sellerId
	 * @return
	 */
	public C2COrderInfoExt create3_ShippedOrder(int userId, int sellerId) {
		// C2COrderInfoExt orderInfo = create17_PostPayOrder(userId, sellerId);
		C2COrderInfoExt orderInfo = create17_AcceptOrder(userId, sellerId);
		int orderId = orderInfo.getiOrderId();
		// 接单
		new OrderCallService().dispatched(orderId, sellerId);
		return orderInfo;
	}

	/**
	 * 创建收货的订单, iTradingStatus=4
	 * 
	 * @param userId
	 * @param sellerId
	 */
	public C2COrderInfoExt create4_ReceivedOrder(int userId, int sellerId) {
		C2COrderInfoExt orderInfo = create3_ShippedOrder(userId, sellerId);
		int orderId = orderInfo.getiOrderId();
		new OrderCallService().confirmReceive(userId, orderId);
		return orderInfo;
	}

	/**
	 * 创建申请退款的订单,, iTradingStatus=4
	 * 
	 * @param userId
	 * @param sellerId
	 * @throws Exception
	 */
	public C2COrderInfoExt create4_ApplyRefundOrder(int userId, int sellerId) {
		C2COrderInfoExt orderInfo = create4_ReceivedOrder(userId, sellerId);
		int orderId = orderInfo.getiOrderId();
		// 申请退款
		new OrderCallService().applySalesRefundRequestInJavaBean(orderId);
		return orderInfo;
	}

	/**
	 * 创建退款成功的订单, iTradingStatus=4
	 * 
	 * @param userId
	 * @param sellerId
	 * @throws Exception
	 */
	public C2COrderInfoExt create4_RefundOrder(int userId, int sellerId) {
		C2COrderInfoExt orderInfo = create4_ApplyRefundOrder(userId, sellerId);
		int orderId = orderInfo.getiOrderId();
		new OrderCallService().salesRefundSuccessRequestInJava(orderId);
		return orderInfo;
	}

	/**
	 * 创建退款失败的订单, iTradingStatus=4
	 * 
	 * @param userId
	 * @param sellerId
	 * @throws Exception
	 */
	public C2COrderInfoExt create4_RefundFailedOrder(int userId, int sellerId) {
		C2COrderInfoExt orderInfo = create4_ApplyRefundOrder(userId, sellerId);
		int orderId = orderInfo.getiOrderId();
		new OrderCallService().salesrefundfailRequestAllProducts(orderId);
		return orderInfo;
	}

	/**
	 * 买家取消订单, iTradingStatus=12
	 * 
	 * @param OrderId
	 * @param UserId
	 */
	public C2COrderInfoExt create12_UserCancelOrder(int userId, int sellerId) {
		C2COrderInfoExt orderInfo = create1_M2cOrder(userId, sellerId);
		int orderId = orderInfo.getiOrderId();
		ArrayList<Integer> orderIdList = new ArrayList<Integer>();
		orderIdList.add(orderId);
		new OrderCallService().batchCancelOrders(userId, orderIdList,
				CancelOrderTypeEnum.BuyerCancelOrder);
		return orderInfo;
	}

	/**
	 * 买家取消订单, iTradingStatus=12
	 * 
	 * @param OrderId
	 * @param UserId
	 */
	public C2COrderInfoExt create12_UserCancelOrderAfterRefund(int userId,
			int sellerId) {
		C2COrderInfoExt orderInfo = create4_RefundOrder(userId, sellerId);
		int orderId = orderInfo.getiOrderId();
		ArrayList<Integer> orderIdList = new ArrayList<Integer>();
		orderIdList.add(orderId);
		new OrderCallService().batchCancelOrders(userId, orderIdList,
				CancelOrderTypeEnum.BuyerCancelOrder);
		return orderInfo;
	}

	/**
	 * 卖家取消订单, iTradingStatus=13
	 * 
	 * @param OrderId
	 * @param UserId
	 */
	public C2COrderInfoExt create13_SellerCancelOrder(int userId, int sellerId) {
		C2COrderInfoExt orderInfo = create1_M2cOrder(userId, sellerId);
		int orderId = orderInfo.getiOrderId();
		ArrayList<Integer> orderIdList = new ArrayList<Integer>();
		orderIdList.add(orderId);
		new OrderCallService().batchCancelOrders(sellerId, orderIdList,
				CancelOrderTypeEnum.SellerCancelOrder);
		return orderInfo;
	}

	/**
	 * 系统取消订单, iTradingStatus=18
	 * 
	 * @param OrderId
	 * @param UserId
	 */
	public C2COrderInfoExt create18_SystemCancelOrder(int userId, int sellerId) {
		CancelOrderBean cancelorderbean = new CancelOrderBean();
		CancelOrderCall cancelordercall = new CancelOrderCall();
		C2COrderInfoExt orderInfo = create1_M2cOrder(userId, sellerId);
		int orderId = orderInfo.getiOrderId();
		String cancelReason = "自动化测试客服取消订单";
		cancelorderbean.setCancelReason(cancelReason);
		cancelorderbean.setCancelType(CancelOrderTypeEnum.CustomerCancelOrder);
		cancelorderbean.setOrderId(orderId);
		cancelorderbean.setUserId(userId);
		// 发送请求
		cancelordercall.setData(cancelorderbean);
		try {
			cancelordercall.callService();
		} catch (ClientProtocolException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return orderInfo;
	}

	/**
	 * 创建已确认订单（待发起补款）的订单, iTradingStatus=17, bPaidInFull=0
	 * 
	 * @param userId
	 * @param sellerId
	 */
	public C2COrderInfo create101_WaitPostPayOrder(int userId, int sellerId) {
		C2COrderInfo orderInfo = create1_BatchC2COrder(userId, sellerId, 1)
				.get(0);
		int orderId = orderInfo.getiOrderId();
		int tradingId = orderInfo.getiTradingId();
		new OrderCallService().orderPayRequest(userId,
				orderInfo.getfTotalPrice(), tradingId);
		new OrderCallService().acceptOrder(orderId, sellerId);
		return orderInfo;
	}

	public static void main(String[] args) {
		int userId = 288484;
		int sellerId = 3383;
		OrderCreate order = new OrderCreate();
		//		order.create1_M2cOrder(userId, sellerId);
		// order.create4_RefundFailedOrder(userId, sellerId);
		// order.create17_AcceptOrder(userId, sellerId);
		// order.create3_ShippedOrder(userId, sellerId);
		// order.create4_ApplyRefundOrder(userId, sellerId);
		// order.createOrderWithSellerCoupon(userId, sellerId);
		//		order.createOrderWithSellerCoupon(userId, sellerId);
		order.setProductCount(3);
		//		for (int i = 0; i < 10; i++) {
		//			order.create1_M2cOrder(userId, sellerId);
		//			order.create2_PayOrder(userId, sellerId);
		//			order.create3_ShippedOrder(userId, sellerId);
		//			order.create4_ReceivedOrder(userId, sellerId);
		//			order.create4_ApplyRefundOrder(userId, sellerId);
		//			order.create4_RefundOrder(userId, sellerId);
		//			order.create4_RefundFailedOrder(userId, sellerId);
		//			order.create12_UserCancelOrder(userId, sellerId);
		//			order.create13_SellerCancelOrder(userId, sellerId);
		//			order.create18_SystemCancelOrder(userId, sellerId);
		//			order.create17_AcceptOrder(userId, sellerId);
		//			order.create17_ApplyRefundOrder(userId, sellerId);
		//			order.create17_RefundOrder(userId, sellerId);
		//			order.create17_RefundFailedOrder(userId, sellerId);
		//		}
	}
}
